package com.cy.sys.controller;

import com.cy.common.pojo.JsonResult;
import com.cy.sys.pojo.Dept;
import com.cy.sys.service.sysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/dept/")
@ResponseBody
public class sysDeptController {
    @Autowired
    private sysDeptService sys;


    @RequestMapping("doFindObjects")
    public JsonResult doFindObjects(){


        return new JsonResult( sys.doFindObjects());
    }
    @RequestMapping("doDeleteObject")
    public JsonResult doDeleteObject(Integer id){
        sys.doDeleteObject(id);

        return new JsonResult("delete ok");
    }
    @RequestMapping("doSaveObject")
    public JsonResult doSaveObject(Dept dept){
        sys.doSaveObject(dept);

        return new JsonResult("添加成功");
    }
    @RequestMapping("doFindZTreeNodes")
    public JsonResult doFindZTreeNodes(){

        return new JsonResult(sys.doFindObjects());
    }
    @RequestMapping("doUpdateObject")
    public  JsonResult doUpdateObject(Dept dept){
        sys.doUpdateObject(dept);
        return new JsonResult("修改成功");
    }

}
